home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1653 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: dt1.datatamers.com!hawke
  2. From: hawke@dt1.datatamers.com (Carlos Urrutia)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What the hell is THIS?!
  5. Date: 16 Jan 1996 01:03:12 GMT
  6. Organization: none
  7. Message-ID: <4detgg$ir7@news.datatamers.com>
  8. References: <4d6rgh$rfu@abel.cc.sunysb.edu> <coc-1301960253420001@dal1498.computek.net>
  9. NNTP-Posting-Host: dt1.datatamers.com
  10.  
  11. In article <coc-1301960253420001@dal1498.computek.net>,
  12. Chad Cranfill <coc@computek.net> wrote:
  13. >In article <4d6rgh$rfu@abel.cc.sunysb.edu>, bmadhusu@engws12.ic.sunysb.edu
  14. >(Bommasamudram Madhusudan) wrote:
  15. >
  16. >> Can someone explain what
  17. >> 
  18. >>   int (*p)[3]  is?????
  19. >> 
  20. >
  21. >Starting with the "p", we parse the expression thusly: "p is an array of 3
  22. >pointers to int". If you need help with this (believe me, I did!) get the
  23. actually, its "p is a pointer to array 3 of int". for it to be an array of
  24. pointers to int, it'd have to be declared as int *p[3].
  25.  
  26. >book "Deep C Secrets". It presents an algorithmic method for decoding
  27. >statements like this, and gives hints on how to implement a C program that
  28. >will do this for you.
  29. funny, thats one of my course books for the advanced c programming class im
  30. taking :)
  31.  
  32. >
  33. >> 
  34. >> I can say things like:
  35. >> 
  36. >> (*p)[0] = 3; for e.g, but when I print the value using:
  37. >> 
  38. >>  printf("%d",(*p)[0]) I get a core dump!
  39. >
  40. >Instead of using the dereference operator here, you may want to just say:
  41. >
  42. >printf("%d", p[0]);
  43. >
  44. >This just seems to be the intuitive way to do this, but since I haven't
  45. >tried this example I could be wrong.
  46. >
  47. >--Chad
  48.  
  49. carlos
  50.